package bma.common.langutil.core;

import java.util.Date;

/**
 * 日期数据 yyyy-MM-dd
 * 
 * @author guanzhong
 * @since 1.0 (imported from BMA.ESP Project)
 * 
 */
public class DateValue extends Date {

	private static final long serialVersionUID = 1L;

	public DateValue() {
		super();
	}

	public DateValue(long date) {
		super(date);
		DateTimeUtil.setTime(this, 0, 0, 0);
	}

	public Date toDate() {
		return new Date(getTime());
	}

	public void fromDate(Date date) {
		this.setTime(date.getTime());
	}

	public static DateValue valueOf(Date date) {
		if (date == null)
			return null;
		DateValue v = new DateValue(date.getTime());
		return v;
	}

	@Override
	public String toString() {
		return DateTimeUtil.formatDate(this);
	}

}
